3.1.97 \(\int \frac {1}{(b+2 a x-b x^2)^2} \, dx\) [97]

Optimal. Leaf size=69 \[ -\frac {a-b x}{2 \left (a^2+b^2\right ) \left (b+2 a x-b x^2\right )}-\frac {b \tanh ^{-1}\left (\frac {a-b x}{\sqrt {a^2+b^2}}\right )}{2 \left (a^2+b^2\right )^{3/2}} \]

[Out]

1/2*(b*x-a)/(a^2+b^2)/(-b*x^2+2*a*x+b)-1/2*b*arctanh((-b*x+a)/(a^2+b^2)^(1/2))/(a^2+b^2)^(3/2)

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 69, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {628, 632, 212} \begin {gather*} -\frac {a-b x}{2 \left (a^2+b^2\right ) \left (2 a x-b x^2+b\right )}-\frac {b \tanh ^{-1}\left (\frac {a-b x}{\sqrt {a^2+b^2}}\right )}{2 \left (a^2+b^2\right )^{3/2}} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(b + 2*a*x - b*x^2)^(-2),x]

[Out]

-1/2*(a - b*x)/((a^2 + b^2)*(b + 2*a*x - b*x^2)) - (b*ArcTanh[(a - b*x)/Sqrt[a^2 + b^2]])/(2*(a^2 + b^2)^(3/2)
)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 628

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[(b + 2*c*x)*((a + b*x + c*x^2)^(p + 1)/((p + 1
)*(b^2 - 4*a*c))), x] - Dist[2*c*((2*p + 3)/((p + 1)*(b^2 - 4*a*c))), Int[(a + b*x + c*x^2)^(p + 1), x], x] /;
 FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0] && LtQ[p, -1] && NeQ[p, -3/2] && IntegerQ[4*p]

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rubi steps

\begin {align*} \int \frac {1}{\left (b+2 a x-b x^2\right )^2} \, dx &=-\frac {a-b x}{2 \left (a^2+b^2\right ) \left (b+2 a x-b x^2\right )}+\frac {b \int \frac {1}{b+2 a x-b x^2} \, dx}{2 \left (a^2+b^2\right )}\\ &=-\frac {a-b x}{2 \left (a^2+b^2\right ) \left (b+2 a x-b x^2\right )}-\frac {b \text {Subst}\left (\int \frac {1}{4 \left (a^2+b^2\right )-x^2} \, dx,x,2 a-2 b x\right )}{a^2+b^2}\\ &=-\frac {a-b x}{2 \left (a^2+b^2\right ) \left (b+2 a x-b x^2\right )}-\frac {b \tanh ^{-1}\left (\frac {a-b x}{\sqrt {a^2+b^2}}\right )}{2 \left (a^2+b^2\right )^{3/2}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 78, normalized size = 1.13 \begin {gather*} \frac {\frac {-a+b x}{b+2 a x-b x^2}-\frac {b \tan ^{-1}\left (\frac {-a+b x}{\sqrt {-a^2-b^2}}\right )}{\sqrt {-a^2-b^2}}}{2 \left (a^2+b^2\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(b + 2*a*x - b*x^2)^(-2),x]

[Out]

((-a + b*x)/(b + 2*a*x - b*x^2) - (b*ArcTan[(-a + b*x)/Sqrt[-a^2 - b^2]])/Sqrt[-a^2 - b^2])/(2*(a^2 + b^2))

________________________________________________________________________________________

Maple [A]
time = 0.58, size = 83, normalized size = 1.20

method result size
default \(\frac {-2 b x +2 a}{\left (-4 a^{2}-4 b^{2}\right ) \left (-b \,x^{2}+2 a x +b \right )}+\frac {2 b \arctanh \left (\frac {-2 b x +2 a}{2 \sqrt {a^{2}+b^{2}}}\right )}{\left (-4 a^{2}-4 b^{2}\right ) \sqrt {a^{2}+b^{2}}}\) \(83\)
risch \(\frac {\frac {b x}{4 a^{2}+4 b^{2}}-\frac {a}{4 \left (a^{2}+b^{2}\right )}}{-\frac {1}{2} b \,x^{2}+a x +\frac {1}{2} b}+\frac {b \ln \left (\left (a^{2} b +b^{3}\right ) x +\left (a^{2}+b^{2}\right )^{\frac {3}{2}}-a^{3}-a \,b^{2}\right )}{4 \left (a^{2}+b^{2}\right )^{\frac {3}{2}}}-\frac {b \ln \left (\left (-a^{2} b -b^{3}\right ) x +\left (a^{2}+b^{2}\right )^{\frac {3}{2}}+a^{3}+a \,b^{2}\right )}{4 \left (a^{2}+b^{2}\right )^{\frac {3}{2}}}\) \(134\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(-b*x^2+2*a*x+b)^2,x,method=_RETURNVERBOSE)

[Out]

(-2*b*x+2*a)/(-4*a^2-4*b^2)/(-b*x^2+2*a*x+b)+2*b/(-4*a^2-4*b^2)/(a^2+b^2)^(1/2)*arctanh(1/2*(-2*b*x+2*a)/(a^2+
b^2)^(1/2))

________________________________________________________________________________________

Maxima [A]
time = 0.52, size = 97, normalized size = 1.41 \begin {gather*} -\frac {b \log \left (\frac {b x - a - \sqrt {a^{2} + b^{2}}}{b x - a + \sqrt {a^{2} + b^{2}}}\right )}{4 \, {\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} + \frac {b x - a}{2 \, {\left (a^{2} b + b^{3} - {\left (a^{2} b + b^{3}\right )} x^{2} + 2 \, {\left (a^{3} + a b^{2}\right )} x\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(-b*x^2+2*a*x+b)^2,x, algorithm="maxima")

[Out]

-1/4*b*log((b*x - a - sqrt(a^2 + b^2))/(b*x - a + sqrt(a^2 + b^2)))/(a^2 + b^2)^(3/2) + 1/2*(b*x - a)/(a^2*b +
 b^3 - (a^2*b + b^3)*x^2 + 2*(a^3 + a*b^2)*x)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 171 vs. \(2 (65) = 130\).
time = 3.39, size = 171, normalized size = 2.48 \begin {gather*} -\frac {2 \, a^{3} + 2 \, a b^{2} + {\left (b^{2} x^{2} - 2 \, a b x - b^{2}\right )} \sqrt {a^{2} + b^{2}} \log \left (\frac {b^{2} x^{2} - 2 \, a b x + 2 \, a^{2} + b^{2} + 2 \, \sqrt {a^{2} + b^{2}} {\left (b x - a\right )}}{b x^{2} - 2 \, a x - b}\right ) - 2 \, {\left (a^{2} b + b^{3}\right )} x}{4 \, {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5} - {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} x^{2} + 2 \, {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} x\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(-b*x^2+2*a*x+b)^2,x, algorithm="fricas")

[Out]

-1/4*(2*a^3 + 2*a*b^2 + (b^2*x^2 - 2*a*b*x - b^2)*sqrt(a^2 + b^2)*log((b^2*x^2 - 2*a*b*x + 2*a^2 + b^2 + 2*sqr
t(a^2 + b^2)*(b*x - a))/(b*x^2 - 2*a*x - b)) - 2*(a^2*b + b^3)*x)/(a^4*b + 2*a^2*b^3 + b^5 - (a^4*b + 2*a^2*b^
3 + b^5)*x^2 + 2*(a^5 + 2*a^3*b^2 + a*b^4)*x)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 218 vs. \(2 (56) = 112\).
time = 0.29, size = 218, normalized size = 3.16 \begin {gather*} - \frac {b \sqrt {\frac {1}{\left (a^{2} + b^{2}\right )^{3}}} \log {\left (x + \frac {- a^{4} b \sqrt {\frac {1}{\left (a^{2} + b^{2}\right )^{3}}} - 2 a^{2} b^{3} \sqrt {\frac {1}{\left (a^{2} + b^{2}\right )^{3}}} - a b - b^{5} \sqrt {\frac {1}{\left (a^{2} + b^{2}\right )^{3}}}}{b^{2}} \right )}}{4} + \frac {b \sqrt {\frac {1}{\left (a^{2} + b^{2}\right )^{3}}} \log {\left (x + \frac {a^{4} b \sqrt {\frac {1}{\left (a^{2} + b^{2}\right )^{3}}} + 2 a^{2} b^{3} \sqrt {\frac {1}{\left (a^{2} + b^{2}\right )^{3}}} - a b + b^{5} \sqrt {\frac {1}{\left (a^{2} + b^{2}\right )^{3}}}}{b^{2}} \right )}}{4} + \frac {a - b x}{- 2 a^{2} b - 2 b^{3} + x^{2} \cdot \left (2 a^{2} b + 2 b^{3}\right ) + x \left (- 4 a^{3} - 4 a b^{2}\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(-b*x**2+2*a*x+b)**2,x)

[Out]

-b*sqrt((a**2 + b**2)**(-3))*log(x + (-a**4*b*sqrt((a**2 + b**2)**(-3)) - 2*a**2*b**3*sqrt((a**2 + b**2)**(-3)
) - a*b - b**5*sqrt((a**2 + b**2)**(-3)))/b**2)/4 + b*sqrt((a**2 + b**2)**(-3))*log(x + (a**4*b*sqrt((a**2 + b
**2)**(-3)) + 2*a**2*b**3*sqrt((a**2 + b**2)**(-3)) - a*b + b**5*sqrt((a**2 + b**2)**(-3)))/b**2)/4 + (a - b*x
)/(-2*a**2*b - 2*b**3 + x**2*(2*a**2*b + 2*b**3) + x*(-4*a**3 - 4*a*b**2))

________________________________________________________________________________________

Giac [A]
time = 0.91, size = 90, normalized size = 1.30 \begin {gather*} -\frac {b \log \left (\frac {{\left | 2 \, b x - 2 \, a - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, b x - 2 \, a + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{4 \, {\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} - \frac {b x - a}{2 \, {\left (b x^{2} - 2 \, a x - b\right )} {\left (a^{2} + b^{2}\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(-b*x^2+2*a*x+b)^2,x, algorithm="giac")

[Out]

-1/4*b*log(abs(2*b*x - 2*a - 2*sqrt(a^2 + b^2))/abs(2*b*x - 2*a + 2*sqrt(a^2 + b^2)))/(a^2 + b^2)^(3/2) - 1/2*
(b*x - a)/((b*x^2 - 2*a*x - b)*(a^2 + b^2))

________________________________________________________________________________________

Mupad [B]
time = 0.32, size = 100, normalized size = 1.45 \begin {gather*} -\frac {\frac {a}{2\,\left (a^2+b^2\right )}-\frac {b\,x}{2\,\left (a^2+b^2\right )}}{-b\,x^2+2\,a\,x+b}+\frac {b\,\mathrm {atan}\left (\frac {a\,b^2\,1{}\mathrm {i}+a^3\,1{}\mathrm {i}-b\,x\,\left (a^2+b^2\right )\,1{}\mathrm {i}}{{\left (a^2+b^2\right )}^{3/2}}\right )\,1{}\mathrm {i}}{2\,{\left (a^2+b^2\right )}^{3/2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(b + 2*a*x - b*x^2)^2,x)

[Out]

(b*atan((a*b^2*1i + a^3*1i - b*x*(a^2 + b^2)*1i)/(a^2 + b^2)^(3/2))*1i)/(2*(a^2 + b^2)^(3/2)) - (a/(2*(a^2 + b
^2)) - (b*x)/(2*(a^2 + b^2)))/(b + 2*a*x - b*x^2)

________________________________________________________________________________________